module fiare.video.screen;

import derelict.sdl.sdl;
import fiare.exception;

class Screen {
	private int _width;
	private int _height;
	private int _bpp;
	private bool _fullscreen;
	private SDL_Surface* _surface;

	this(int width, int height, int bpp, bool fullscreen = false) {
		int flags = SDL_HWSURFACE | SDL_ANYFORMAT | SDL_DOUBLEBUF;
		
		if(fullscreen)
			flags |= SDL_FULLSCREEN;
		
		_surface = SDL_SetVideoMode(width, height, bpp, flags);
		
		if(_surface == null)
			throw new SdlException("Unable to set video mode");
		
		_width = _surface.w;
		_height = _surface.h;
		_fullscreen = cast(bool) (_surface.flags & SDL_FULLSCREEN);
		_bpp = _surface.format.BitsPerPixel;
	}
	

}

